package lab01;

public class Test06 {

    public static void main(String[] args) {

//用if-else语句实现

        int score=3;

        String str="";

//判断成绩，输出表现
        if(score==1) {
            str= "不及格";
        }

        if(score==2) {
            str= "及格";
        }

        if(score==3){
            str="中等";
        }

        if(score==4){
            str="良好";
        }

        if(score==5){
            str="优秀";
        }

        System.out.println("if-else语句");
        System.out.println("成绩为"+score+"的等级为："+str);

        System.out.println();

//switch实现
        int grade=4,n=0;

        String st="";

        n=grade/1;

        switch(n){

            case 1:
                st="不及格";break;

            case 2:
                st="及格";break;

            case 3:
                st="中等";break;

            case 4:
                st="良好";break;

            case 5:
                st="优秀";break;

        }
        System.out.println("switch语句");
        System.out.println("成绩"+grade+"的等级为："+st);
    }

}
